package cn.edu.ctbu.datajpa04.api;


import cn.edu.ctbu.datajpa04.domain.Student;
import cn.edu.ctbu.datajpa04.helper.RUtil;
import cn.edu.ctbu.datajpa04.service.StudentService;
import cn.edu.ctbu.datajpa04.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/login")
public class LoginApiController {

    @Autowired
    private StudentService studentService;

    @GetMapping("/student")
    public R student(String name,String password) throws Exception{
        Student student=studentService.findByNameAndPassword(name, password);
        return RUtil.success(student);
    }
}
